/**
 * 
 */
define(["jquery", "knockout","durandal/composition",'BMap','panel',
         "http", "i18nCommon","kovholder",'WdatePicker','video','css!style/common/common-style'],
		function($, ko, composition, baiduMap, panal, http, i18nCommon,kov,WdatePicker,videojs){

	function model(){
    	var self = this;
    	var IP = "134.200.0.240";
		var port = "80";
		var UserName = "admin";
		var Password = "Abc123++";
		var VAGIP = "134.200.0.240";
		var VAGPort = "7302";
		var Code = "001063";

		composition.addBindingHandler("videoreplay-init",{
			init: function(dom){
				p = panal.getPanalByElement(dom);
				_dom = dom;
				initUI();
				initData();
				LoginPlat()				
		}});
		
		function initUI() {

		}
		
		function LoginPlat()
		{

			//默认使用密码登录方式
			var v1 = "<?xml version=\"1.0\" encoding=\"utf-8\"?><LoginInfo><LoginType>2</LoginType><IP>" + IP + "</IP><Port>" + port
				+ "</Port><UserName>" + UserName + "</UserName><Password>" + Password + "</Password></LoginInfo>";
			var v = videoReplay.LoginPlat(v1);
			if(v !== 0){
				alert("登录失败，请查看日志preview.log");
			}else{
				StartPreview();
			}						
		}
		
		//新的预览接口，需先登录平台，登录需要耗点时间，稍等（控件自身取Token）
		function StartPreview(){			
			var _param = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>"
				+ "<PlaybackBasicInfo><CameraIndexCode>001083</CameraIndexCode>"
				+ "<StoreDeviceType>0</StoreDeviceType>"
				+ "<BeginTime>2016-01-25T00:00:00.000Z</BeginTime><EndTime>2016-01-25T23:59:59.000Z</EndTime>"
				+ "</PlaybackBasicInfo>";
			videoReplay.SetBasicInfoEx( _param);
		}
		
		function initData(){
			
		}
	}
	
    return model;
});